package com.tutucms.service.admin.controller;

import com.tutucms.common.model.request.PageCondition;
import com.tutucms.common.model.response.Paging;
import com.tutucms.common.model.response.ResponseResult;
import com.tutucms.service.admin.service.UserService;
import com.tutucms.service.auth.TokenValidator;
import com.tutucms.service.admin.model.vo.UserVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by wangxudong on 2020/08/27.
 *
 * @version: 1.0
 * @modified :
 */
@Api(value = "测试接口", tags = "测试接口")
@RestController
@RequestMapping(value = "/user")
public class UserController {

    @Autowired
    private UserService userService;

    @ApiOperation(value = "用户列表")
    @TokenValidator(false)
    @PostMapping("/list")
    public ResponseResult<Paging<UserVo>> userList(@Validated @RequestBody PageCondition pageCondition) {

        return ResponseResult.successResult(userService.getUserList(pageCondition));
    }
}
